package gogs_hook

import "atomgit.com/openlinksaas-org/proto-gen-go.git/events/events_gogs"

type ForkHook struct {
	Forkee *Repository `json:"forkee"`
	Repo   *Repository `json:"repository"`
	Sender *User       `json:"sender"`
}

func (item *ForkHook) ToProtoBuf() *events_gogs.ForkEvent {
	ret := &events_gogs.ForkEvent{
		Forkee: []*events_gogs.Repository{},
		Repo:   []*events_gogs.Repository{},
		Sender: []*events_gogs.User{},
	}
	if item.Forkee != nil {
		ret.Forkee = append(ret.Forkee, item.Forkee.ToProtoBuf())
	}
	if item.Repo != nil {
		ret.Repo = append(ret.Repo, item.Repo.ToProtoBuf())
	}
	if item.Sender != nil {
		ret.Sender = append(ret.Sender, item.Sender.ToProtoBuf())
	}
	return ret
}
